<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
</head>
<p>Flask Tornado</p>
<textarea id="log"style="
    width: 300px;
    height: 200px;
" ></textarea>
<br>
<input id="say" type="text" >
<button id="send" type="button">Send!</button>
<body>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://dev.admin.walle-web.io/socket.io.min.js"></script>
<script>
    $(document).ready(function () {
        namespace = '/websocket'

        var socket = io.connect('http://' + document.domain + namespace);
        socket.on('connect', function () {
            socket.emit('joined', {});
        });

        socket.on('message', function (data) {
            $('#log').val($('#log').val() + data.msg + '\n' );
            console.log(data)
        });

        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $("#send").trigger("click");
                say = $('#say').val();
                socket.emit('deploy', {msg: say});
                $('#say').val('')
            }
        });
    });

</script>
</body>
</html>
